package com.hua.base;

public class CloneConstructorDemo {
    private int[] arr;



    public CloneConstructorDemo() {
        arr = new int[10];
        for (int i = 0; i < arr.length; i++) {
            arr[i] = i;
        }
    }
    public CloneConstructorDemo(CloneConstructorDemo original) {
        arr = new int[original.arr.length];
        for (int i = 0; i < original.arr.length; i++) {
            arr[i] = original.arr[i];
        }
    }
    public void set(int index, int value){
        arr[index] = value;
    }
    public int get(int index){
        return arr[index];
    }

    public static void main(String[] args) {
        CloneConstructorDemo e1 = new CloneConstructorDemo();
        CloneConstructorDemo e2 = new CloneConstructorDemo(e1);
        e1.set(2,222);
        System.out.println(e2.get(2));

    }
}
